package com.braveman.im.ui.holder;

import android.content.Context;
import android.widget.ImageView;
import android.widget.TextView;

import com.braveman.im.R;
import com.braveman.im.bean.LocationBean;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.ht.baselibs.ui.base.BaseViewHolder;
import com.ht.baselibs.utils.AbDateUtil;

public class MessageListViewHolder extends BaseViewHolder<LocationBean> {

    private ImageView mIvChatIcon;
    private TextView mTvChatName;
    private TextView mTvMessagePreview;
    private TextView mTvMessageDate;
    private Context mContext;
    private int cont = 1;

    public MessageListViewHolder(Context context) {
        super(R.layout.list_message_item);
        mContext = context;
    }

    @Override
    protected void initView() {
        mIvChatIcon = findViewById(R.id.iv_chat_icon);
        mTvChatName = findViewById(R.id.tv_chat_name);
        mTvMessagePreview = findViewById(R.id.tv_message_preview);
        mTvMessageDate = findViewById(R.id.iv_message_date);
    }

    @Override
    protected void refreshView(LocationBean locationBean) {
        Glide.with(mContext)//
                .load("http://static.jinkaimen.cn/bank/CMB.png")//
                .into(mIvChatIcon);
        mTvChatName.setText(locationBean.name + cont++);
        mTvMessagePreview.setText("聊天内容");
        mTvMessageDate.setText(AbDateUtil.getCurrentDate(AbDateUtil.dateFormatYMD));
    }
}
